home *** CD-ROM | disk | FTP | other *** search
/ 1,000+ Great Games / 1_1000 Games.iso / CASINO / CHALO.ZIP / CHALO40.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1995-01-22  |  16.6 KB  |  548 lines

  1. {Program Chalo Version 4.0
  2. Written by Terry Uland, 1992
  3. Revised 9-30-94, 10-12-94, 10-13-94, 10-14-94, 10-15-94, 10-20-94
  4. Last revision 1-19-95 -- Rewritten in Turbo Pascal 7.0}
  5. Program Chalo40;
  6. {$M $4000,0,0 }   { 16K stack, no heap }
  7. uses crt, dos;
  8. const
  9.      Path = 'c:\';                      {Path                   }
  10.      Fil = '';                          {File name              }
  11.      HighScore = '';                    {High score value       }
  12. var
  13.    Data             : text;              {c:\tp\hiscore.dat      }
  14.    Instructions     : char;             {Instructions Question  }
  15.    Dummy            : char;             {Dummy Variable         }
  16.    Ac               : char;             {Difficulty level choice}
  17.    X                : integer;          {Dummy Variable         }
  18.    chap             : integer;          {Chap                   }
  19.    players          : integer;          {Players                }
  20.    points           : integer;          {Points                 }
  21.    DifficultyLevel  : string;           {Difficulty Level       }
  22.    chaphigh         : integer;          {Highest chap           }
  23.    Cd               : char;             {Command Choice         }
  24.    wager            : integer;          {Wager                  }
  25.    die1             : integer;          {Die One Value          }
  26.    die2             : integer;          {Die Two Value          }
  27.    roll             : integer;          {Roll Value             }
  28.    name             : string;           {Name of Player         }
  29.    quit             : char;             {Quit [Y/N]             }
  30.    wh               : char;             {Which One?             }
  31.    programname      : string;           {Executable Program     }
  32.    Delete           : char;             {Delete?                }
  33.    DumAss           : string;           {You shouldn't be here! }
  34.  
  35.  
  36. Procedure Initialize;
  37. begin
  38.      Randomize;
  39.      Textmode(co40);
  40.      chap := 1;
  41.      wh := '0';
  42. end;
  43.  
  44. Procedure Title;
  45. begin
  46.      clrscr;
  47.      textcolor(yellow);
  48.      gotoxy (100, 1);
  49.      writeln('CCCCC');
  50.      gotoxy (1, 2);
  51.      writeln('C');
  52.      gotoxy (1, 3);
  53.      writeln ('C');
  54.      gotoxy (1, 4);
  55.      writeln('C');
  56.      gotoxy (1, 5);
  57.      writeln('CCCCC');
  58.      gotoxy (9, 1);
  59.      writeln('H   H');
  60.      gotoxy (9, 2);
  61.      writeln('H   H');
  62.      gotoxy (9, 3);
  63.      writeln('HHHHH');
  64.      gotoxy (9, 4);
  65.      writeln('H   H');
  66.      gotoxy (9, 5);
  67.      writeln('H   H');
  68.      gotoxy (17, 1);
  69.      writeln('AAAAA');
  70.      gotoxy (17, 2);
  71.      writeln('A   A');
  72.      gotoxy (17, 3);
  73.      writeln('AAAAA');
  74.      gotoxy (17, 4);
  75.      writeln('A   A');
  76.      gotoxy (17, 5);
  77.      writeln('A   A');
  78.      gotoxy (25, 1);
  79.      writeln('L');
  80.      gotoxy (25, 2);
  81.      writeln('L');
  82.      gotoxy (25, 3);
  83.      writeln('L');
  84.      gotoxy (25, 4);
  85.      writeln('L');
  86.      gotoxy (25, 5);
  87.      writeln('LLLLL');
  88.      gotoxy (33, 1);
  89.      writeln('OOOOO');
  90.      gotoxy (33, 2);
  91.      writeln('O   O');
  92.      gotoxy (33, 3);
  93.      writeln('O   O');
  94.      gotoxy (33, 4);
  95.      writeln('O   O');
  96.      gotoxy (33, 5);
  97.      writeln('OOOOO');
  98.      textcolor(red);
  99.      gotoxy (12, 8);
  100.      writeln('By Waadi Games,');
  101.      gotoxy (4, 10);
  102.      writeln('A Division of Uland Industries');
  103.      textcolor(white);
  104.      gotoxy (1, 15);
  105.      Write('Would you like instructions?(Y/N): ');
  106.      readln(Instructions);
  107.      IF (instructions = 'y') THEN
  108.         begin;
  109.               clrscr;
  110.               textcolor(yellow);
  111.               gotoxy (4, 1);
  112.               writeln('- - - - - C H A L O - - - - -');
  113.               textcolor(lightgray);
  114.               gotoxy (5, 4);
  115.               writeln('Welcome to Chalo.  The game is ');
  116.               gotoxy (1, 5);
  117.               writeln('simple.  The object of the game  is to');
  118.               gotoxy (1, 6);
  119.               writeln('complete 10 chaps, or levels, while ');
  120.               gotoxy (1, 7);
  121.               writeln('earning as many points as possible by ');
  122.               gotoxy (1, 8);
  123.               writeln('wagering.  You begin the game with 100 ');
  124.               gotoxy (1, 9);
  125.               writeln('points and 4 players.  If you lose all ');
  126.               gotoxy (1, 10);
  127.               writeln('of your players, you lose all of your ');
  128.               gotoxy (1, 11);
  129.               writeln('winnings.  The first decision to be ');
  130.               gotoxy (1, 12);
  131.               writeln('made is the path.  If you chose the long');
  132.               gotoxy (1, 13);
  133.               writeln('path, game play proceeds normally. ');
  134.               gotoxy (1, 14);
  135.               writeln('However, if you select the short one,');
  136.               gotoxy (1, 15);
  137.               writeln('the chances of losing a player are ');
  138.               gotoxy (1, 16);
  139.               writeln('doubled, but so are the winnings.');
  140.               gotoxy (1, 17);
  141.               writeln('The second decision is the wager.  It ');
  142.               gotoxy (1, 18);
  143.               writeln('cannot be over the amount you have, and ');
  144.               gotoxy (1, 19);
  145.               writeln('minimum bet is 1 point.  Remember, if ');
  146.               gotoxy (1, 20);
  147.               writeln('you lose al your players, you lose all');
  148.               gotoxy (1, 21);
  149.               writeln('your winnings.  Good Luck!');
  150.         end;
  151.         textcolor(white);
  152.         gotoxy (3, 23);
  153.         write('Press <RETURN> to continue . . .');
  154.         read(dummy);
  155. end;
  156. {*******}
  157. procedure getcustom;
  158. begin
  159.      textbackground(black);
  160.      clrscr;
  161.      textcolor(yellow);
  162.      gotoxy (4, 1);
  163.      writeln('- - - - - C H A L O - - - - -');
  164.      textcolor(cyan);
  165.      gotoxy (8, 6);
  166.      writeln('Input Custom Settings');
  167.      gotoxy (5, 11);
  168.      writeln('Highest Chap      : ');
  169.      gotoxy (5, 15);
  170.      writeln('Number of players : ');
  171.      gotoxy (5, 19);
  172.      writeln('Starting Cash     : ');
  173.      gotoxy (25, 11);
  174.      read(chaphigh);
  175.      gotoxy (25, 15);
  176.      read(players);
  177.      gotoxy (25, 19);
  178.      read(points);
  179.      textcolor(white);
  180.      repeat
  181.            gotoxy (8, 23);
  182.            writeln('Press any key to continue. ');
  183.      until keypressed;
  184. end;
  185.  
  186. {*******}
  187. procedure prochoice;
  188. begin
  189.      textbackground(black);
  190.      clrscr;
  191.      textcolor(yellow);
  192.      gotoxy (4, 1);
  193.      writeln('- - - - - C H A L O - - - - -');
  194.      textcolor(cyan);
  195.      gotoxy (8, 5);
  196.      writeln('Choose Difficulty Level');
  197.      gotoxy (5, 8);
  198.      writeln('1.  Beginner');
  199.      gotoxy (5, 10);
  200.      writeln('2.  Intermediate');
  201.      gotoxy (5, 12);
  202.      writeln('3.  Expert');
  203.      gotoxy (5, 14);
  204.      writeln('4.  Master');
  205.      gotoxy (5, 16);
  206.      writeln('5.  Grand Master');
  207.      gotoxy (5, 18);
  208.      writeln('6.  Custom');
  209.      repeat
  210.            gotoxy (7, 22);
  211.            write('What level would you like? ');
  212.            read(ac);
  213.      until (ac = '1') or (ac = '2') or (ac = '3') or (ac = '4') or (ac = '5') or (ac = '6');
  214.      If ac = '1' THEN
  215.         begin;
  216.               chaphigh := 10;
  217.               players := 6;
  218.               points := 150;
  219.               difficultylevel := 'Beginner';
  220.         end;
  221.      IF ac = '2' THEN
  222.         begin;
  223.               chaphigh :=10;
  224.               players := 4;
  225.               points := 100;
  226.               difficultylevel := 'Intermediate';
  227.         end;
  228.      IF ac = '3' THEN
  229.         begin;
  230.               chaphigh := 15;
  231.               players := 4;
  232.               points := 75;
  233.               difficultylevel := 'Expert'
  234.         end;
  235.      IF ac = '4' THEN
  236.         begin;
  237.               chaphigh := 15;
  238.               players := 3;
  239.               points := 50;
  240.               difficultylevel := 'Master';
  241.         end;
  242.      IF ac = '5' THEN
  243.         begin;
  244.               chaphigh := 20;
  245.               players := 3;
  246.               points := 25;
  247.               difficultylevel := 'Grand Master';
  248.         end;
  249.      IF ac = '6' THEN getcustom;
  250. end;
  251. {*******}
  252. procedure outputdata;
  253. begin;
  254. {dt$ = DATE$
  255. tm$ = TIME$}
  256.     assign(data, 'c:\tp\hiscore.dat');
  257.     append(data);
  258.     writeln(data, name:20, points:20, difficultylevel:20);
  259.     close(data)
  260. end;
  261. {*******}
  262. procedure hiscore;
  263. begin
  264.      textbackground(black);
  265.      clrscr;
  266.      textcolor(yellow);
  267.      gotoxy (4, 1);
  268.      writeln('- - - - - C H A L O - - - - -');
  269.      textcolor(white);
  270.      gotoxy (8, 5);
  271.      writeln('High Score Utilities');
  272.      textcolor(13);
  273.      gotoxy (5, 9);
  274.      writeln('1.  View High Scores');
  275.      gotoxy (5, 11);
  276.      writeln('2.  Reset High Scores');
  277.      gotoxy (5, 13);
  278.      writeln('3.  Print High Scores');
  279.      gotoxy (5, 15);
  280.      writeln('4.  Exit Utilities');
  281.      textcolor(12);
  282.      repeat
  283.            gotoxy (11, 19);
  284.            write('Which One: ');
  285.            read(wh);
  286.      until (wh = '1') or (wh = '2') or (wh = '3') or (wh = '4');
  287.      IF wh = '1' THEN
  288.         begin;
  289.               textmode(co80);
  290.               ProgramName := '/c c:\tp\viewhi.bat';
  291.               SwapVectors;
  292.               Exec(GetEnv('COMSPEC'), programname);
  293.               SwapVectors;
  294.               readln;
  295.               textmode(co40);
  296.         end;
  297.      IF wh = '2' THEN
  298.         begin;
  299.               repeat
  300.                     gotoxy (3, 21);
  301.                     write('Delete List -- Are you sure?(Y/N): ');
  302.                     readln(delete);
  303.               until (delete = 'y') or (delete = 'n');
  304.               IF delete = 'y' THEN
  305.                  begin;
  306.                        textmode(co80);
  307.                        programname := '/c c:\tp\delhi.bat';
  308.                        swapvectors;
  309.                        exec(getenv('COMSPEC'),programname);
  310.                        swapvectors;
  311.                        textmode(co40);
  312.                  end;
  313.  
  314.         end;
  315.      IF wh = '3' THEN
  316.         begin;
  317.               textmode(co80);
  318.               programname := '/c c:\tp\printhi.bat';
  319.               swapvectors;
  320.               exec(getenv('COMSPEC'),programname);
  321.               swapvectors;
  322.               textmode(co40);
  323.         end;
  324. end;
  325. procedure main;
  326. label
  327.      1,         {Out of Money termination} {MNS}
  328.      2,         {Made it Home termination} {HM}
  329.      3,         {Repeat Loop 1           } {RPT1}
  330.      4,         {Repeat Loop 2           } {RPT2}
  331.      5,         {Repeat Loop 3           } {RPT3}
  332.      6,         {About Information       } {ABT}
  333.      8,         {Quit Game               } {QT}
  334.      9,         {Short Path Selection    } {ST}
  335.      10,        {Long Path Selection     } {LG}
  336.      11,        {Lose a Player           } {PLA}
  337.      12,        {Lose Wager              } {lose}
  338.      13,        {Win wager               } {win}
  339.      14,        {Start of Procedure      } {program}
  340.      15,        {Players Gone            } {PG}
  341.      16,        {Win Short Path          } {WN2}
  342.      17;        {End of Module           } {end}
  343. begin
  344.      14: IF points <= 0 THEN GOTO 1;
  345.      IF chap > chaphigh THEN GOTO 2;
  346.      textbackground(black);
  347.      clrscr;
  348.      textcolor(yellow);
  349.      gotoxy (4, 1);
  350.      writeln('- - - - - C H A L O - - - - -');
  351.      textcolor(11);
  352.      gotoxy (1, 3);
  353.      writeln('Score = ',points);
  354.      gotoxy (1, 5);
  355.      writeln('Players = ',players);
  356.      gotoxy (1, 7);
  357.      writeln('Chap = ',chap);
  358.      textcolor(13);
  359.      gotoxy (1, 10);
  360.      writeln('Press L for long path, S for short,');
  361.      gotoxy (1, 11);
  362.      writeln('A for about, H for high score, and ');
  363.      gotoxy (1, 12);
  364.      writeln('Q to quit Chalo.');
  365.      3: textcolor(white);
  366.      gotoxy (1, 14);
  367.      write('Command (L/S/A/H/Q)? ');
  368.      read(cd);
  369.      IF (cd = 'l') OR (cd = 's') OR (cd = 'a') OR (cd = 'h') OR (cd = 'q') THEN GOTO 5
  370.          ELSE GOTO 3;
  371.      5: IF (cd = 'a') THEN GOTO 6;
  372.      IF (cd = 'h') THEN
  373.         begin;
  374.               hiscore;
  375.         end;
  376.      IF (cd = 'q') THEN GOTO 17;
  377.      If (cd = 'l') then goto 4;
  378.      if (cd = 's') then goto 4;
  379.      goto 14;
  380.      4: gotoxy (1, 16);
  381.      write('Input Wager: ');
  382.      read(wager);
  383.      IF (wager > points) OR (wager < 1.0) THEN GOTO 4;
  384.      gotoxy (1, 18);
  385.      write('Hit <RETURN> to roll dice. ');
  386.      readln(dummy);
  387.      IF (cd = 's') THEN GOTO 9;
  388.      10: die1 := Trunc(random(7));
  389.      die2 := Trunc(random(7));
  390.      roll := die1 + die2;
  391.      IF (roll = 6) OR (roll = 7) or (roll = 0) THEN GOTO 10;
  392.      gotoxy (1, 20);
  393.      writeln('You rolled a ',roll,'.');
  394.      IF roll < 4 then GOTO 11
  395.         ELSE IF roll > 8 THEN GOTO 12
  396.              ELSE GOTO 13;
  397.      13: textcolor(12);
  398.      gotoxy (1, 22);
  399.      writeln('YOU WON! GOTO NEXT CHAP!');
  400.      points := points + wager;
  401.      chap := chap + 1;
  402.      gotoxy (3, 24);
  403.      write('Press <RETURN> to continue . . .');
  404.      read(dummy);
  405.      GOTO 14;
  406.      12: textcolor(11);
  407.      gotoxy (1, 22);
  408.      writeln('You lost your wager.  Goto next chap.');
  409.      points := points - wager;
  410.      chap := chap + 1;
  411.      gotoxy (3, 24);
  412.      write('Press <RETURN> to continue . . .');
  413.      read(dummy);
  414.      GOTO 14;
  415.      11: textcolor(8);
  416.      IF roll = 2 THEN
  417.         begin;
  418.               gotoxy (1, 22);
  419.               writeln('An American Soldier mistook you for ');
  420.               gotoxy (1, 23);
  421.               writeln('Saddam Hussain! Your through.');
  422.         end
  423.         else IF roll = 3 THEN
  424.              begin;
  425.                    gotoxy (1, 22);
  426.                    writeln('I told you it was dangerous to drive');
  427.                    gotoxy (1, 23);
  428.                    writeln('a Ford.  You lost a player.');
  429.              end
  430.              else
  431.                  begin;
  432.                        gotoxy (1, 22);
  433.                        writeln('You idiot, next time take the long ');
  434.                        gotoxy (1, 23);
  435.                        writeln('path! You lost a player.');
  436.                  end;
  437.      players := players - 1;
  438.      IF players = 0 THEN GOTO 15;
  439.      chap := chap + 1;
  440.      gotoxy (3, 24);
  441.      write('Press <RETURN> to continue . . .');
  442.      read(dummy);
  443.      GOTO 14;
  444.      9: die1 := trunc(random(7));
  445.      die2 := trunc(random(7));
  446.      roll := die1 + die2;
  447.      IF (roll = 6) OR (roll = 7) or (roll = 0) THEN GOTO 9;
  448.      gotoxy (1, 20);
  449.      writeln('You rolled a ',roll,'.');
  450.      IF roll < 6 THEN GOTO 11
  451.         ELSE IF roll > 9 THEN GOTO 12
  452.              ELSE GOTO 16;
  453.      16: textcolor(12);
  454.      gotoxy (1, 22);
  455.      writeln('YOU WON! SKIP A CHAP!');
  456.      points := points + wager;
  457.      points := points * 2;
  458.      chap := chap + 2;
  459.      gotoxy (3, 24);
  460.      write('Press <RETURN> to continue . . .');
  461.      read(dummy);
  462.      GOTO 14;
  463.      15: textbackground(black);
  464.      clrscr;
  465.      textcolor(8);
  466.      gotoxy (1, 12);
  467.      writeln('You lost all your players and winnings.');
  468.      gotoxy (1, 14);
  469.      writeln('Better luck next time . . . ');
  470.      gotoxy (1, 16);
  471.      write('Press <RETURN> . . . ');
  472.      read(dummy);
  473.      goto 17;
  474.      1: textbackground(black);
  475.      clrscr;
  476.      textcolor(11);
  477.      gotoxy (1, 12);
  478.      writeln('You ran out of money.');
  479.      gotoxy (1, 14);
  480.      writeln('Better luck next time . . . ');
  481.      gotoxy (1, 16);
  482.      write('Press <RETURN> . . . ');
  483.      read(dummy);
  484.      goto 17;
  485.      2: textbackground(black);
  486.      clrscr;
  487.      textcolor(12);
  488.      gotoxy (1, 12);
  489.      writeln('You made it home!');
  490.      gotoxy (1, 14);
  491.      writeln('Score = ',points);
  492.      gotoxy (1, 16);
  493.      write('Enter your name: ');
  494.      readln(name);
  495.      outputdata;
  496.      gotoxy (1, 18);
  497.      writeln('Your high score has been saved.');
  498.      gotoxy (1, 20);
  499.      write('Press <RETURN> to continue . . . ');
  500.      read(dummy);
  501.      goto 17;
  502.      6: textbackground(black);
  503.      clrscr;
  504.      textcolor(14);
  505.      gotoxy (4, 1);
  506.      writeln('- - - - - C H A L O - - - - -');
  507.      textcolor(12);
  508.      gotoxy (11, 6);
  509.      writeln('Chalo Version 4.0');
  510.      gotoxy (11, 10);
  511.      writeln('Created 1-21-95');
  512.      gotoxy (12, 15);
  513.      writeln('By Terry Uland');
  514.      gotoxy (2, 20);
  515.      writeln('Copyright (C) 1995 Uland Industries');
  516.      textcolor(white);
  517.      gotoxy (3, 23);
  518.      write('Press <RETURN> to continue . . .');
  519.      readln;
  520.      readln(dumass);
  521.      if dumass = 'CDR' then chap := chaphigh + 1;
  522.      GOTO 14;
  523.      8: textcolor(white);
  524.      gotoxy (3, 16);
  525.      write('Quit -- Are you sure?(Y/N): ');
  526.      readln(quit);
  527.      IF (quit = 'y') THEN goto 17;
  528.      goto 14;
  529.      17:
  530. end;
  531. {label
  532.      1,
  533.      2;}
  534. begin;
  535.       Initialize;       {Initialize variables, screen and path}
  536.       Title;            {Title Page                           }
  537.       Prochoice;        {Choice of Level                      }
  538.       Main;             {Main Program                         }
  539. END.                    {End of Program                       }
  540.  
  541.  
  542.  
  543.  
  544.  
  545.  
  546.  
  547.  
  548.